package study.dq.jms.exception;

import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;

/**
 * @author dongqun
 * @version 1.0.0
 * @since 2021/04/20 17:03:00
 */
public class MQExceptionListener implements ExceptionListener, MessageListener {
    @Override
    public void onException(JMSException e) {
        e.printStackTrace();
    }

    @Override
    public void onMessage(Message message) {
        try {
            message.acknowledge();
        } catch (JMSException ignored) {

        }
        System.out.println(message.toString());
    }
}
